package com.gxa.controller.score;

import com.gxa.common.R.ResponseData;
import com.gxa.pojo.Score;
import com.gxa.service.score.ScoreService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequiresPermissions({"绩效评分"})
@Api(value = "绩效评分test", tags = "绩效评分接口api")
@RequestMapping("/performance")
public class ScoreController {

    @Autowired
    private ScoreService scoreService;

    //1.员工绩效评分
    @RequestMapping(value = "/system", method = RequestMethod.GET)
    @ApiOperation(value = "员工绩效评分接口",notes = "进入员工绩效评分",httpMethod = "get", response = ResponseData.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",paramType = "query",dataType = "String",required = true)
    })
    @ResponseBody
    public ResponseData system(@RequestParam(required = true) Integer currentPage, @RequestParam(required = true) Integer pageSize){
        return scoreService.system(currentPage, pageSize);
    }

    //2.进入评分
    @RequestMapping(value = "/scoreIn", method = RequestMethod.GET)
    @ApiOperation(value = "进入评分接口",notes = "进入评分界面",httpMethod = "get", response = ResponseData.class)
    @ApiImplicitParam(name = "id",value = "员工id",required = true,dataType = "String",paramType = "query")
    @ResponseBody
    public ResponseData scoreIn(@RequestParam(name = "id") Integer id){
        return scoreService.scoreIn(id);
    }

    //3.绩效评分
    @RequestMapping(value = "/addScore", method = RequestMethod.POST)
    @ApiOperation(value = "绩效评分接口",notes = "绩效评分",httpMethod = "post", response = ResponseData.class)
    @ResponseBody
    public ResponseData addScore(@RequestBody @ApiParam(name = "给员工评分",value = "员工分数 id",required = true) Score score){
        return scoreService.addScore(score);
    }

    //4.员工评分
    @RequestMapping(value = "/addScore2", method = RequestMethod.POST)
    @ApiOperation(value = "员工评分接口",notes = "员工评分",httpMethod = "post", response = ResponseData.class)
    @ResponseBody
    public ResponseData addScore2(@RequestBody @ApiParam(name = "给员工评分",value = "员工分数 id",required = true) Score score){
        return scoreService.addScore2(score);
    }

    //5.搜索绩效评分
    @RequestMapping(value = "/selectScore", method = RequestMethod.GET)
    @ApiOperation(value = "搜索绩效评分接口",notes = "搜索绩效评分",httpMethod = "post", response = ResponseData.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "selectMsg",value = "搜索信息类型",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "keyWord",value = "关键字",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "currentPage",value = "当前页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",paramType = "query",dataType = "String",required = true)
    })
    @ResponseBody
    public ResponseData selectScore(@RequestParam(required = true) String selectMsg, @RequestParam(required = true) String keyWord, @RequestParam(required = true) Integer currentPage, @RequestParam(required = true) Integer pageSize){
        return scoreService.selectScore(selectMsg, keyWord, currentPage, pageSize);
    }

    //6.进入绩效评分记录
    @RequestMapping(value = "/record", method = RequestMethod.GET)
    @ApiOperation(value = "进入绩效评分记录接口",notes = "进入绩效评分记录",httpMethod = "get", response = ResponseData.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",paramType = "query",dataType = "String",required = true)
    })
    @ResponseBody
    public ResponseData record(@RequestParam(required = true) Integer currentPage, @RequestParam(required = true) Integer pageSize){
        return scoreService.record(currentPage, pageSize);
    }

    //7.搜索绩效评分记录
    @RequestMapping(value = "/selectRecord", method = RequestMethod.GET)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "keyWord",value = "关键字",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "currentPage",value = "当前页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示记录数",paramType = "query",dataType = "String",required = true)
    })
    @ResponseBody
    public ResponseData selectRecord(@RequestParam(required = true) String keyWord, @RequestParam(required = true) Integer currentPage, @RequestParam(required = true) Integer pageSize){
        return scoreService.selectRecord(keyWord, currentPage, pageSize);
    }

}
